<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
    <title>АгроПроектИнжиниринг</title>
</h:head>
<h:body>
    <div class="page">
        <div class="pageHeader">
            <h:form id="mainMenu">

                <p:hotkey bind="enter" actionListener="#{searchBean.search}" oncomplete="#{searchBean.redirectToResultPage()}" />

                <p:menubar autoDisplay="false">
                    <p:submenu label="Проекты" icon="ui-icon-document">
                        <p:menuitem value="Просмотреть" url="/view/projects.xhtml" />
                        <p:separator />
                        <p:menuitem value="Добавить" actionListener="#{projectBean.addProject()}"
                                    oncomplete="mainMenu.update()"/>
                    </p:submenu>

                    <p:submenu label="Заказчики" icon="ui-icon-pencil">
                        <p:menuitem value="Просмотреть" url="/view/customers.xhtml" icon="ui-icon-arrowreturnthick-1-w" />
                        <p:menuitem value="Добавить" actionListener="#{customerBean.addCustomer()}"
                                    icon="ui-icon-arrowreturnthick-1-e" oncomplete="mainMenu.update()" />
                    </p:submenu>

                    <p:submenu label="Материалы" icon="ui-icon-help">
                        <p:menuitem value="Просмотреть" url="/view/materials.xhtml" />
                        <p:menuitem value="Добавить номенклатуру" url="/view/dialogs/addMaterial.xhtml" />
                        <p:menuitem value="Ввести приход" actionListener="#{equipmentsBean.addEquipment()}"
                                oncomplete="mainMenu.update()"/>
                        <p:menuitem value="Внести расход" actionListener="#{equipmentsBean.addMaterialConsumption()}"
                                oncomplete="mainMenu.update()"/>
                    </p:submenu>

                    <p:submenu label="Сотрудники" icon="ui-icon-gear">
                        <p:menuitem value="Просмотреть" url="/view/employees.xhtml"/>
                        <p:menuitem value="Добавить" actionListener="#{employeesBean.addEmployee()}"
                                oncomplete="mainMenu.update()"/>
                    </p:submenu>

                    <p:submenu label="Техника" icon="ui-icon-gear">
                        <p:menuitem value="Просмотреть" url="/view/mechanisms.xhtml" />
                        <p:submenu label="Назначить" icon="ui-icon-refresh">
                            <p:menuitem value="На проект" actionListener="#{mechanismsBean.assignProject}"
                                        icon="ui-icon-disk" oncomplete="mainMenu.update()"/>
                            <p:menuitem value="Задачу"  actionListener="#{mechanismsBean.assignTask}"
                                        icon="ui-icon-arrowrefresh-1-w" oncomplete="mainMenu.update()"/>
                        </p:submenu>
                        <p:menuitem value="Добавить" actionListener="#{mechanismsBean.addMechanism}"
                                    oncomplete="mainMenu.update()" />
                    </p:submenu>



                    <f:facet name="options">
                        <p:inputText style="margin-right:10px" />
                        <p:commandButton type="button" value="Поиск" icon="ui-icon-extlink" />
                    </f:facet>
                </p:menubar>


            </h:form>
        </div>
        <div class="pageContent">
            <ui:insert name="content" />
        </div>
        <div class="pageFooter"></div>
    </div>
</h:body>
</html>